package com.tedu._07interceptor.config;

import com.tedu._07interceptor.Interceptor.CheckLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class Config implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new MyInterceptor());
        registry.addInterceptor(new CheckLoginInterceptor()).addPathPatterns("/users/reg","/users/login");

        registry.addInterceptor(new CheckLoginInterceptor()).addPathPatterns("/users/**");

        registry.addInterceptor(new CheckLoginInterceptor()).addPathPatterns("/users/**").excludePathPatterns("/users/reg","/users/logout");
    }
}
